package com.kanavi.redisson.business.controller;


import com.common.boot.common.CommonResult;
import com.kanavi.redisson.business.entity.Order;
import com.kanavi.redisson.business.service.OrderService;
import java.util.List;
import javax.annotation.Resource;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * <p>
 * 前端控制器
 * </p>
 *
 * @author tanghailan
 * @since 2021-03-28
 */
@RestController
@RequestMapping("/business/order")
public class OrderController {

  @Resource
  private OrderService orderService;

  @PostMapping("/add")
  public CommonResult add(Order order) {
    boolean save = orderService.save(order);
    return CommonResult.success("请求成功!");
  }

  @GetMapping("/list")
  public CommonResult list() {
    List<Order> list = orderService.list();
    return CommonResult.success(list);
  }

}

